package service

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"videosrv/basic/golbal"
	"videosrv/handler/request"
	"videosrv/model"
)

func Video(c *gin.Context) {
	req := request.VideoReq{}
	err := c.ShouldBind(&req)
	if err != nil {
		return
	}
	video := model.Video{

		Title:        req.Title,
		Label:        req.Label,
		Image:        req.Image,
		Introduction: req.Introduction,
		Right:        req.Right,
	}

	golbal.DB.Debug().Create(&video)
	c.JSON(http.StatusOK, gin.H{
		"code": 200,
		"msg":  "视频发布成功",
	})
}
